'''
Created on 24.11.2011

@author: hkh
'''

from CashFlowUtils.IceBonds import *
from Calendar.Iceland import *
from datetime import date
from datetime import timedelta

ddate = date(2011,11,11)
yld = 0.06
bond = RIKB190226()

price = bond.cleanprice(ddate, yld)

print bond.cleanprice(ddate, yld)
print bond.dirtyprice(ddate, yld)    
print bond.duration(ddate,yld)
print bond.yld(ddate, price)

#cf = bond.remaining_cashflows(ddate)
cf = bond.cashflows()

for obj in cf:
    print obj.yearfrac, obj.cfdate, obj.daysPeriod, obj.amount, obj.notional, obj.interests, obj.amortization

print '-------------------------------------'

bond2 = HFF150224()

yld2 = 0.02

print bond2.dirtyprice(ddate, yld2)
print bond2.cleanprice(ddate, yld2)

cf2 = bond2.cashflows()

for obj in cf2:
    print obj.yearfrac, obj.cfdate, obj.daysPeriod, obj.amount, obj.notional, obj.interests, obj.amortization

'''
sec1 = RIKB250612()
print sec1.cleanprice(ddate, yld)
cf = sec1.cashflows()
for obj in cf:
    print obj.cfdate, obj.notional, obj.amount, obj.notional, obj.interests, obj.amortization
'''